package com.hpf.gupao.pattern.singleton.threadlocal;

/**
 * @description:
 * @datetime: 2021/5/18 15:01
 * @author: huangpengfei
 */
public class ThreadLocalSingleton {

    private static final ThreadLocal<ThreadLocalSingleton> SINGLETON_THREAD_LOCAL = ThreadLocal.withInitial(() -> new ThreadLocalSingleton());

    private ThreadLocalSingleton(){

    }

    public static ThreadLocalSingleton getInstance() {
        return SINGLETON_THREAD_LOCAL.get();
    }
}
